<template>
  <div class="basic-layout">
    <div class="nav-aside">
      <div class="logo">
        <img src="../assets/logo.png" alt="" />
        <span>Message</span>
      </div>
      <!-- <item v-for="(item,index) in list" :key="index" :item="item"></item> -->
      <!-- <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        background-color="#031528"
        router
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-s-tools"></i>
            <span>系统管理</span>
          </template>
          <el-menu-item index="/system/user">用户管理</el-menu-item>
          <el-menu-item index="/system/menu">菜单管理</el-menu-item>
          <el-menu-item index="/system/role">角色管理</el-menu-item>
          <el-menu-item index="/system/dept">部门管理</el-menu-item>
        </el-submenu>
        <el-submenu index="2">
          <template slot="title">
            <i class="el-icon-s-promotion"></i>
            <span>审批管理</span>
          </template>
          <el-menu-item index="/system/leave">休假申请</el-menu-item>
          <el-menu-item index="/system/approve">待我审批</el-menu-item>
        </el-submenu>
      </el-menu> -->
      <el-menu
        :default-active="$route.path"
        background-color="#031528"
        router
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <item v-for="(item, index) in list" :key="index" :item="item"></item>
      </el-menu>
    </div>
    <div class="content-right">
      <div class="nav-top">
        <div class="nav-left">
          <div class="menu-fold">
            <i class="el-icon-s-fold"></i>
          </div>
          <div class="bread">
            <bread-crumb></bread-crumb>
          </div>
        </div>
        <div class="user-info">
          <el-badge class="notice">
            <i class="el-icon-bell"></i>
          </el-badge>
          <el-dropdown>
            <span class="el-dropdown-link user-link">
              {{ $store.state.userInfo.userName || "" }}
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                >邮箱: {{ $store.state.userInfo.userEmail }}</el-dropdown-item
              >
              <el-dropdown-item>退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </div>
      <div class="wrapper">
        <div class="main-page">
          <router-view></router-view>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Item from "./item.vue";
import BreadCrumb from "./BreadCrumb.vue";
export default {
  name: "layout",
  props: ['item'],
  components: { BreadCrumb, Item },
  data() {
    return {
      list: [
        {
          id: "1",
          name: "系统管理",
          icon: "el-icon-s-tools",
          child: [
            {
              name: "用户管理",
              path: "/system/user",
            },
            {
              name: "菜单管理",
              path: "/system/menu",
            },
            {
              name: "角色管理",
              path: "/system/role",
            },
            {
              name: "部门管理",
              path: "/system/dept",
            },
          ],
        },
        {
          id: "2",
          name: "审批管理",
          icon: "el-icon-s-promotion",
          child: [
            {
              name: "休假申请",
              path: "/system/leave",
            },
            {
              name: "待我审批",
              path: "/system/approve",
            },
          ],
        },
      ],
    };
  },
  mounted() {},
  methods: {},
};
</script>

<style scoped lang="scss">
.basic-layout {
  position: relative;
  .nav-aside {
    width: 200px;
    height: 100vh;
    position: fixed;
    color: #fff;
    background-color: #031528;
    overflow-y: auto;
    .logo {
      display: flex;
      height: 50px;
      display: flex;
      align-items: center;
      img {
        margin: 0 16px;
        width: 32px;
        height: 32px;
      }
    }
    .el-menu {
      border-right: none;
    }
  }
  .content-right {
    margin-left: 200px;
    .nav-top {
      height: 50px;
      background-color: #fff;
      padding: 0 20px;
      border-bottom: 1px solid #ddd;
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: absolute;
      right: 0;
      left: 200px;
      .nav-left {
        display: flex;
        align-items: center;
        .menu-fold {
          font-size: 18px;
          margin-right: 15px;
        }
      }
      .user-info {
        .notice {
          margin-right: 15px;
          line-height: 30px;
          cursor: pointer;
        }
        .user-link {
          cursor: pointer;
          color: #409eff;
        }
        .el-dropdown-menu__item:hover {
          color: #333 !important;
        }
      }
    }
    .wrapper {
      background: #eef0f3;
      height: 100%;
      padding: 20px;
      padding-top: 71px;
      .main-page {
        min-height: calc(100vh - 50px);
        height: 100%;
        background: #fff;
      }
    }
  }
}
</style>
